'use strict';

module.exports = app => {
  const { router, controller: { reply }, middleware: { validator, checkPageTable, checkParams } } = app;

  const baseUrl = '/api/reply';
  router.get(baseUrl + '/house/:houseId', checkParams('houseId'), checkPageTable(), reply.indexByHouseId);
  router.get(baseUrl + '/comment/:cid', checkParams('cid'), checkPageTable(), reply.indexByCommentId);
  router.get(baseUrl + '/my', checkPageTable(), reply.indexMy);
  router.get(baseUrl + '/examine', checkPageTable(), reply.indexExamine);
  router.patch(baseUrl + '/agree', validator('common.checkId'), reply.agree);
  router.patch(baseUrl + '/disagree', validator('common.checkId'), reply.disagree);
  router.get(baseUrl, checkPageTable(), reply.index);
  router.get(baseUrl + '/:id', checkParams(), reply.show);
  router.post(baseUrl, validator('reply.create'), reply.create);
  router.delete(baseUrl + '/:id', checkParams(), reply.destroy);
};
